import request from '@/utils/request'

/**
 * 获取同类商品数据
 * @param {String} id 同类商品id
 * @param {Number} limit 获取的数据数量
 * @returns promise
 */
export const findRelGoods = (id, limit = 16) => {
  return request('/goods/relevant', 'get', { id, limit })
}

/**
 * 热销榜商品数据
 * @param {*} 详细信息可看接口文档
 * @returns promise
 */
export const findHotGoods = ({ id, limit = 3, type }) => {
  return request('/goods/hot', 'get', { id, limit, type })
}

/**
 * 获取商品评论数据
 * @param {String} id 商品id
 * @returns Promise
 */
export const findCommentInfoGoods = (id) => {
  return request(`https://mock.boxuegu.com/mock/1175/goods/${id}/evaluate`, 'get')
}

/**
 * 获取评论详情
 * @param {String} id 商品id
 * @returns promise
 */
export const findGoodsCommentList = (id, params) => {
  return request(`https://mock.boxuegu.com/mock/1175/goods/${id}/evaluate/page`, 'get', params)
}

/**
 * 获取最新商品的sku
 * @param {*} id
 * @returns
 */
export const getSpecsAndSku = (id) => {
  return request(`/goods/sku/${id}`, 'get')
}
